<!DOCTYPE HTML>
<html>
<head>
<meta name="baidu-site-verification" content="fk6z1Saxz4" />
<meta charset="UTF-8">
<meta name="description" content="{$cacheState.website_description}" />
<meta name="keywords" content="{$cacheState.website_keywords}">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta content="telephone=no" name="format-detection">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<title>
{if $controllerActive == $navigation[0].navigation_url|truncate:4:""} 
{$navigation[0].navigation_name}_爱车易得
{elseif $controllerActive ==$navigation[2].navigation_url|truncate:7:""}
{$navigation[2].navigation_name}_爱车易得
{elseif $controllerActive ==$navigation[4].navigation_url|truncate:9:""}
{$navigation[4].navigation_name}_爱车易得
{elseif $controllerActive ==$navigation[5].navigation_url|truncate:6:""}
{$navigation[5].navigation_name}_爱车易得
{elseif $controllerActive==$smarty.server.REQUEST_URI|mb_substr:13:7:'utf-8'}

{$reuslt.goods_model}款 {$reuslt.goods_name} {$reuslt.goods_describe} {$reuslt.goods_car}_爱车易得
{else} 
爱车易得

{/if}
</title>

  <link rel = "Shortcut Icon" href="{$home}images/ico_10.ico"/>
  {if $css}
  {foreach $css as $each}
  {if substr($each,0,7) !='http://'}
  <link  type="text/css" rel="stylesheet" href="{$absroot}{$each}"/>
  {else}
  <link  type="text/css" rel="stylesheet" href="{$each}"/>
  {/if}
  {/foreach}
  {/if}

  

  <style>

.hide-sel-1{ padding-right:0}.hide-sel-2{ padding-left:0}.hide-sel-2{ padding-left:0}.hide-sel-2  select{ border-left:none;border-top-left-radius:0;border-bottom-left-radius:0;}.hide-sel-1 select{ border-top-right-radius:0;border-bottom-right-radius:0;}.sbtn{ border-radius:4px;}.navbar-default ul .nav1,.navbar-default ul .nav2,.navbar-default ul .nav3,.navbar-default ul .nav4,.navbar-default ul .nav5,.navbar-default ul .nav6,.navbar-default ul .nav7{ padding:0 10px;}.navbar{ margin-bottom:0}
  



  </style>
</head>

<body>
 
<!-- 弹出层 登录-->
<div class="modal" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" >
  <div class="modal-content">
       
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h2 class="modal-title" id="myModalLabel">手机快捷登录</h2>
    </div>
    <div class="modal-body" >
              <br>
                  <span class="err-phone" style="color:red;font-size: 14px;margin:;"></span>&nbsp;<span style="color: #FF8742" class="err-info" ></span>
              <br>
              <br>


               <div class="input-group" >
                 <span class="input-group-addon">+86</span>
                 <input type="tel" class="form-control input-lg mobile-val phone" id="inputGroupSuccess3" aria-describedby="inputGroupSuccess3Status" placeholder="请输入手机号" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >
               </div>
              <br>
               <div class="input-group" >


                 <input type="tel" class="form-control input-lg code-val" id="inputGroupSuccess3" aria-describedby="inputGroupSuccess3Status" placeholder="动态码"onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" >

                  <span class="input-group-addon yz-code remove" >获取验证码</span>
               </div>
              </div>
    

        <div class="modal-footer" style="border-top: none;margin:0 50px;">
          
          <button class="btn  btn-lg btn-sub" id="btn-sub" style="background:#46a8ef;width: 100%; ">登录</button>
        </div>
    </div>
  
   
    
  </div>
</div>
</div>  


<!-- 弹出层 预约-->
<div class="modal " id="myModals-appointment" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" >
  <div class="modal-content">
    
    <div class="modal-header">
     <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
     <h4 class="modal-title" id="myModalLabel"><strong>预约到店</strong></h4>
     <br>
     <p> 留下你的联系方式并选择附近门店，我们将在24小时内安排门店销售顾问与您联系</p>
       </div>
       
       <div class="modal-body" >
      <form class="form-horizontal form-yueyue hidden-xs" onsubmit="return false">
        <div class="form-group name" >
          <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
          <div class="col-sm-10 col-md-6 username-err" >
            <input type="text" class="form-control name-val" id="inputEmail3" placeholder="请输入姓名" name="subscribe_name">
          </div>
          <label class="radio-inline" style="margin-left:20px;">
            <input type="radio" name="inlineRadioOptions" id="inlineRadio1" checked value="1" > 先生
          </label>
       
          <label class="radio-inline" style="margin-right:0;">
            <input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="0"> 女士
          </label>
        <input type="hidden" value="1" name="subscribe_sex">
         <input type="hidden" value="" name="goods_id">
        </div>
        <br>
        <div class="form-group">
          <label for="inputPassword3" class="col-sm-2 control-label ">手机号</label>
          <div class="col-sm-10">
            <input type="text" class="form-control mobile-session" id="inputPassword3" name="user_phone" placeholder="" value="{$session}" readonly>
          </div>
        </div>
        
        <br>
       <div class="form-group">
         <label for="" class="col-sm-2 control-label " style="padding-left: 0">到店时间</label>
         <div class="input-append date form_datetime col-sm-10" data-date="2013-02-21T15:25:00Z">
             
             <input type="text" class="form-control" value="" readonly placeholder="请选择日期" class="" name="subscribe_time">
             <span class="add-on"  ><i class="icon-remove" ></i></span>
             <span class="add-on"  ><i class="icon-calendar" ></i></span>
         </div>
       </div>
       <br>
       <div class="form-group">
         <label for="" class="col-sm-2 control-label" style="padding-left: 0">选择城市</label>
         <div class="col-sm-10">
           <select class="form-control store-ct" name="subscribe_city">
           {foreach $storecache as $k=>$v}
             <option>{$k}</option>
           {/foreach}
           </select>
         </div>
       </div>
       <br>
       <div class="form-group">
         <label for="" class="col-sm-2 control-label" style="padding-left: 0">选择门店</label>
         <div class="col-sm-10">
           <select class="form-control store-ct-vi" name="subscribe_ctiy_name">
              
         
           </select>
         </div>
       </div>
      </form>
        <!-- H5 -->
          <form class="form-horizontal form-yueyue  hidden-md hidden-lg">
            <div class="form-group name" style="margin:0" >
              <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
              <div class="col-sm-10 col-md-6 username-err" >
                <input type="text" class="form-control name-val" id="inputEmail3" placeholder="请输入姓名" name="subscribe_name">
              </div>
              <label class="radio-inline" style="margin-left: 17px">
                <input type="radio" name="inlineRadioOptions" id="inlineRadio1" checked value="1" > 先生
              </label>
           
              <label class="radio-inline" >
                <input type="radio" name="inlineRadioOptions" id="inlineRadio2" value="0"> 女士
              </label>
            <input type="hidden" value="1" name="subscribe_sex">
<input type="hidden" value=" " name="goods_id">
            </div>
            <br>
            <div class="form-group" style="margin:0">
              <label for="inputPassword3" class="col-sm-2 control-label ">手机号</label>
              <div class="col-sm-10">
                <input type="text" class="form-control mobile-session" id="inputPassword3" name="user_phone" placeholder="" value="{$session}" readonly>
              </div>
            </div>
            
            <br>
           <div class="form-group" style="margin:0">
             <label for="" class="col-sm-2 control-label " >到店时间</label>
             <div class="input-append date form_datetime col-sm-10" data-date="2013-02-21T15:25:00Z">
                 
                 <input type="text" class="form-control" value="" readonly placeholder="请选择日期" class="" name="subscribe_time">
                 <span class="add-on"  ><i class="icon-remove" ></i></span>
                 <span class="add-on"  ><i class="icon-calendar" ></i></span>
             </div>
           </div>
           <br>
           <div class="form-group" style="margin:0">
             <label for="" class="col-sm-2 control-label" >选择城市</label>
             <div class="col-sm-10">
               <select class="form-control store-ct" name="subscribe_city">
               {foreach $storecache as $k=>$v}
                 <option>{$k}</option>
               {/foreach}
               </select>
             </div>
           </div>
           <br>
           <div class="form-group" style="margin:0">
             <label for="" class="col-sm-2 control-label">选择门店</label>
             <div class="col-sm-10">
               <select class="form-control store-ct-vi" name="subscribe_ctiy_name">
                  
             
               </select>
             </div>
           </div>
          </form>        
       </div>
       
       <div class="modal-footer hidden-xs " style="border-top: none;margin:0 12% 0 25%;">
     
     <button class="btn btn-lg btn-block btn-sub sub-yuyue" style="background:#46a8ef " >提交</button>
       </div>
       <!-- h5 -->
      <div class="modal-footer hidden-md hidden-lg  " style="border-top: none;padding-bottom:20%">
     
     <button class="btn btn-lg btn-block btn-sub sub-yuyue" style="background:#46a8ef " >提交</button>
       </div>
    
      
  </div>
</div>
</div> 
<!-- 弹出层意向车型 -->
<div class="modal " id="myModal-intention" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document" >
  <div class="modal-content">
    
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <h4 class="modal-title" id="myModalLabel"><strong>我想买</strong></h4>
      <br>

    </div>

    <div class="modal-body" >
       <form class="form-horizontal ">
         <div class="form-group ct-err hidden-xs">
           <label for="inputEmail3" class="col-sm-2 control-label" style="padding-left: 0">品牌车系</label>
           
         <div class="col-sm-5 ctiy-sel-1 car-info-sel-1 hide-sel-1" >
        
           <select class="form-control intention_car_type"  placeholder="请选择品牌" id="">
             <option selected="">--请选择品牌--</option>
            {foreach $carinfo as $k=>$v}
            
             <option style="background: #ddd" disabled="disabled">{$k}</option>
             {foreach $v as $key=>$value} 
              {foreach $value as $ke=>$val} 
             <option class="check-opin">{$ke}</option>
              {/foreach }
             {/foreach }
            {/foreach}

           </select>
            
         </div>
         <div class="col-sm-5 ctiy-sel-2 car-info-sel-2 hide-sel-2">
          
           <select class="form-control intention_car_data" placeholder="" disabled="disabled" id="">
           
             <option>--请选择车型--</option>

             
           </select>
            
   
          </div>
         </div>
         <!-- 折叠 品牌-->
          <div class="form-group ct-err hidden-md hidden-lg " style="margin:0">
            <label for="inputEmail3" class="col-sm-2 control-label" >品牌车系</label>
            
          <div class="col-sm-5 ctiy-sel-1 car-info-sel-1" >
          
            <select class="form-control intention_car_type h5_intention_car_type"  placeholder="请选择品牌" id="">
              <option selected="">--请选择品牌--</option>
             {foreach $carinfo as $k=>$v}
             
              <option style="background: #ddd" disabled="disabled">{$k}</option>
              {foreach $v as $key=>$value} 
               {foreach $value as $ke=>$val} 
              <option class="check-opin">{$ke}</option>
               {/foreach }
              {/foreach }
             {/foreach}

            </select>
             
          </div>
          <br>
          <div class="col-sm-5 ctiy-sel-2 car-info-sel-2">
           
            <select class="form-control intention_car_data h5_intention_car_data" placeholder="" disabled="disabled" id="">
            
              <option>--请选择车型--</option>

              
            </select>
             
          
           </div>
          </div>

         <br>
          <!-- 城市 -->
        <form class="form-horizontal ">
          <div class="form-group is-erro hidden-xs">
            <label for="inputEmail3" class="col-sm-2 control-label" style="padding-left: 0">选择城市</label>
            <div data-toggle="distpicker">
            <div class="col-sm-5 ctiy-sel-1 hide-sel-1" >
            <div style="" >
              <select class="form-control ct-se-1"  placeholder="" id="intention_province">
              
              </select>
            </div>
            </div>
            <div class="col-sm-5 ctiy-sel-2 hide-sel-2">
            <div style="" >
              <select class="form-control ct-se-2" placeholder="" id="intention_ctiy">
               
              </select>
             </div>
             </div>
             </div>
          </div>
          <!-- 折叠城市 -->
           <div class="form-group is-erro hidden-md hidden-lg" style="margin:0">
              <label for="inputEmail3" class="col-sm-2 control-label" >选择城市</label>
              <div data-toggle="distpicker">
              <div class="col-sm-5 ctiy-sel-1" >
              <div style="" >
                <select class="form-control ct-se-1"  placeholder="" id="intention_province">
                
                </select>
              </div>
              </div>
              <br>
              <div class="col-sm-5 ctiy-sel-2">
              <div style="" >
                <select class="form-control ct-se-2" placeholder="" id="intention_ctiy">
                 
                </select>
               </div>
               </div>
               </div>
          </div>
   
        <br>
        <div class="form-group use-error hidden-xs" >
          <label for="inputPassword3" class="col-sm-2 control-label">姓名</label>
          <div class="col-sm-10">
            <input type="text" class="form-control intention_username" id="" placeholder="请输入你的姓名" >
          </div>
        </div>
        <br>
        <div class="form-group hidden-xs">
          <label for="inputPassword3" class="col-sm-2 control-label" >手机号</label>
          <div class="col-sm-10">
            <input type="text" class="form-control mobile-session" id="intention_user_phone" placeholder="" value="{$session}" readonly>

            <p style="margin-top: 10px;">留下你的联系方式，如有新消息随时通知您</p>

          </div>
        </div>
        <!-- 折叠姓名电话 -->
        <div class="form-group use-error hidden-md hidden-lg hidden-sm" style="margin:0">
          <label for="inputPassword3" class="col-sm-2 control-label">姓名</label>
          <div class="col-sm-10">
            <input type="text" class="form-control intention_username" id="" placeholder="请输入你的姓名" >
          </div>
        </div>
        <br>
        <div class="form-group  hidden-md hidden-lg hidden-sm" style="margin:0">
          <label for="inputPassword3" class="col-sm-2 control-label" >手机号</label>
          <div class="col-sm-10">
            <input type="text" class="form-control mobile-session" id="intention_user_phone" placeholder="" value="{$session}" readonly>

            <p style="margin-top: 10px;">留下你的联系方式，如有新消息随时通知您</p>

          </div>
        </div>
       </form>     
              
    </div>

    <div class="modal-footer hidden-xs" style="margin:0 12.5% 15px 25%;border-top: none;">
      
      <button class="btn btn-lg btn-block btn-sub yx-sub" style="background:#46a8ef ">提交</button>
    </div>
    <div class="modal-footer hidden-md hidden-lg" style="border-top: none;">
      
      <button class="btn btn-lg btn-block btn-sub yx-sub" style="background:#46a8ef ">提交</button>
    </div>
    
  </div>
</div>
</div> 

 <!--导航-->  
 <!--导航-->  
 
    <div class="navbar navbar-top navbar-default" role="navigation" >  
      <div class="container-fluid">  
        <div class="navbar-header nav-title ">  
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">  
            <span class="sr-only">Toggle navigation</span>  
            <span class="icon-bar"></span>  
            <span class="icon-bar"></span>  
            <span class="icon-bar"></span>  
          </button>  
          
          <a  class="navbar-brand " href="{url('/')}">
              <img class="header-logo" src="{$absroot}static/home/images/logo_4.png" height="36" alt="" style="position: absolute;top: 8px;">
          </a>  
        
        </div>  
        <div class="collapse navbar-collapse navbar-right is-collapse">  
          <ul class="nav navbar-nav">  
            
           <li class='nav1 {if $controllerActive == $navigation[0].navigation_url|truncate:4:""} active {/if}'  >
               <a href="{url('/'|cat:$navigation[0].navigation_url)}" class="" >
               <img src="{$home}images/hot_3.png" alt="" style="position: absolute;right: 0;top: -7px;" class="hidden-xs">
               <span >{$navigation[0].navigation_name}</span>
               </a>
           </li>
          
           <li id="wechat-follow" class="nav2">
               <a href="javascript:;">{$navigation[1].navigation_name}</a>
               <div class="wechat-follow" >
                  <img src="" width="93" alt="">
                  <div class="ft-16">关注微信公众号</div>
              </div>
           </li>
           <!-- 问题 -->
           <li class='nav3 {if $controllerActive ==$navigation[2].navigation_url|truncate:7:""} active{/if}'>
               <a href="{url('/'|cat:$navigation[2].navigation_url)}">{$navigation[2].navigation_name}</a>
           </li>
           <!-- 关于我们 -->
           <li class='url nav4 '>
               <a href="javascript:void(0)">{$navigation[3].navigation_name}</a>
           </li>
           {if $session}
           <!-- 预约 -->
           <li class='yuyue nav5 {if $controllerActive ==$navigation[4].navigation_url|truncate:9:""} active {/if} '>
               <a href="{url('/'|cat:$navigation[4].navigation_url)}">{$navigation[4].navigation_name} <span class="layui-badge">{$yuYueNum|@count}</span></a>
           </li>
           <!-- 关注 -->
           <li class='guanzhu_nav nav6 {if $controllerActive ==$navigation[5].navigation_url|truncate:6:""} active {/if}'>
               <a href="{url('/'|cat:$navigation[5].navigation_url)}">{$navigation[5].navigation_name} <img src="{$home}images/attention-yet-icon.png" height="16"></a>
           </li>
            <div style="padding-left: 25px;" class="hidden-md hidden-lg hidden-sm logouts">
                <a href="" onclick="return false" class="btn btn-danger btn-block  ">
                <div class="" style="display: block;">退出登录</div>
                </a>
            </div>
           <li class="user_logout hidden-xs">
              <a href="javascript:;">
               <i class="iconfont icon-avatar"></i>
               </a>
           </li>
           {else}
           <!-- 登录 -->
           <li id="login-show" class="nav7">
              <!-- <button type="button" class="login-car">{$navigation[6].navigation_name}</button> -->
               <a href="javascript:void(0);" class="login-car">{$navigation[6].navigation_name}</a>
           </li>
           
       
         

           {/if}
          </ul>  
        </div><!-- /.nav-collapse -->  
         <div class="logout">{$replacePhone} <button class="btn btn-block btn-danger">退出</button>  </div>
      </div><!-- /.container -->  
    </div>  

  {if $js}
  {foreach $js as $each}
  {if substr($each,0,7) !='http://'}
  <script type="text/javascript" src="{$absroot}{$each}"></script>
  {else}
  <script type="text/javascript" src="{$each}"></script>
  {/if}
  {/foreach}
  {/if}
  
{block name=body}



{/block}

<div class="container-fluid footer" style="margin-bottom: 30px;"> <!--底部-->
<div class="container">
<div class="row foot-logo">
<div class="col-md-3 col-sm-4 col-xs-12">
<img src="{$absroot}static/home/images/logo_4.png" alt="爱车易得" height="36">
<div class="phone ft-24">4000-000-000</div>
<div class="ft-sm service">拨打客服热线，随时为您解答</div>
</div>
<div class="col-md-3 col-sm-2 col-xs-12 ft-sm ft-nav">
<div><a href="{url('/type')}">我要买车</a></div>
<div><a href="./introduce.html">了解爱车易得</a></div> 
<div><a href="{url('/problem')}">常见问题</a> </div>
</div>
<div class="col-md-3 col-sm-3 col-md-offset-3 col-sm-offset-3 hidden-xs">
<div class="pull-right">
<img src=" " alt="" width="93" >
<div class="ft-center ft-sm download-code">关注爱车易得</div>
</div>
</div>
</div>
</div>
<div class="container hidden-xs">
<div class="ft-sm copyRight">

<span class="ft-gray3">
Copyright © {$time} <span style="cursor: pointer" onclick="indexShow()">aicheyide.com</span> 四川爱车易得汽车销售有限公司.All rights reserved 蜀 ICP备 17036095号 <img src="{$home}images/icp.png" alt=""><span style="cursor: pointer" onclick="icp()">川公网安备 51010702000854号</span>
</span>
<span class="pull-right ft-gray3">
成都市锦江区总府路时代广场A座&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;4000-000-000
</span>
</div>
<br>
</div>
</div>


<div class="side hidden-xs">

  <ul>
      
<!-- 
      <li class="wechat qq1"><a href="tencent;?uin=461092848&Site=qq&Menu=yes"><img src="{$home}images/qq_new.png" class="qq-1"></a></li>
      <div class="kf1"><span class="">QQ在线咨询</span></div> -->
    
<!--<li class="wechat qq2"><a href=""><img src="{$home}images/qq.png"></a></li>
      <div class="kf2">在线咨询QQ人工客服2</div> -->
       
      
     <!--  <li class="wechat we-bloc"><a href="#"><img src="{$home}images/wechat_new.png" width=""></a></li>
      <div class="wechat-l" ><span style="padding-left: 10px;">关注微信公众号</span><img src="{$home}images/weixin.jpg" alt="" width=""></div>
      <li class="wechat phone"><a href=""><img src="{$home}images/phone_new.png"></a></li>
      
      <span class="span-phone">028-66668888</span> -->
      <li style="border-top:1px solid #eee;"><a href="javascript:goTop();" class="sidetop"><img src="{$home}images/top_new.png"></a></li>
  </ul>
</div>

<div id="testAdd"></div>
<script src="{$home}js/fang/modal.min.js"></script>
<script src="{$static}riqi/js/bootstrap-datetimepicker.js"></script>
<script src="{$static}riqi/js/locales/bootstrap-datetimepicker.fr.js"></script>
<script src="{$static}riqi/js/locales/bootstrap-datetimepicker.zh-CN.js"></script>
<!-- <script charset="utf-8" src="http://wpa.b.qq.com/cgi/wpa.php"></script> -->

<script type="text/javascript">

function icp(){
  window.open("http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=51010702000854");
}
function indexShow(){
  window.location.href="https://www.aicheyide.com";
}

$(function(){


//门店循环

$('.store-ct').on('change',function(){
$('.store-ct-vi').find('option').remove();
var storeVal = $(this).val();
{foreach $storecache as $key=>$value}
 {foreach $value as $v}
  if(storeVal == '{$key}'){
    {foreach $v as $va}
      
    $('.store-ct-vi').append('<option >{$va}</option>');
    }
    {/foreach}
  
 {/foreach}
  

{/foreach}
})
var sotVa = $('.store-ct').val();
{foreach $storecache as $key=>$value}
if(sotVa=='{$key}'){
  {foreach $value as $k=>$v}
  {foreach $v as $val}
  $('.store-ct-vi').append('<option>{$val}</option>');

  {/foreach}
  {/foreach}
}
{/foreach}

$('.name').find('.name-val').blur(function(){
    {literal}
    var re1 = /^[\u4E00-\u9FA5]{2,8}$/; 
    {/literal}

  var nameVal = $(this).val();

   if(!re1.test(nameVal)){
      $('.name').addClass('use-err');
       layer.msg('用户名格式错误', function(){
          
       });
   }
   else{
      // $('.sub-yuyue').removeAttr('disabled');
      $('.name').removeClass('use-err');
   }
})
$('#inlineRadio1').unbind('click').click(function(){
  $('.name').find('input[name="subscribe_sex"]:hidden').val(1);
})
$('#inlineRadio2').unbind('click').click(function(){
  $('.name').find('input[name="subscribe_sex"]:hidden').val(0);
})
//提交预约
$('.sub-yuyue').unbind('click').bind('click',function(){
     
 var  userPhone = $('input[name="user_phone"]').val(),
      goodsId = $('input[name="goods_id"]').val(),
      subscribeCtiyName = $('select[name="subscribe_ctiy_name"]').val(),
      subscribeName = $('input[name="subscribe_name"]').val(),
      subscribeSex = $('input[name="subscribe_sex"]').val(),
      subscribeTime = $('input[name="subscribe_time"]').val(),
      subscribeCity = $('select[name="subscribe_city"]').val();

      if($('.name').hasClass('use-err')||$('.name').find('.name-val').val()==''){
        layer.msg('用户名格式错误', function(){
          
       });
        $('.username-err').addClass('has-error');
         
        return false;
      }
      else{


      ajax({
        url: "{url('home/Subscribe/ajaxYuYue')}",
        type: "POST",
        data: {
          user_phone:userPhone,
          goods_id:goodsId,
          subscribe_ctiy_name:subscribeCtiyName,
          subscribe_name:subscribeName,
          subscribe_sex:subscribeSex,
          subscribe_time:subscribeTime,
          subscribe_city:subscribeCity
        },
        dataType: "json",

        success: function(response, xml){

           console.log(response);
           if(response==1){
            var successNum = $('.layui-badge').text();
                successNum++;
               $('.layui-badge').text(successNum);
            var successHtml = '<div class="modal-header"><button type="button"class="close"data-dismiss="modal"aria-label="Close"><span aria-hidden="true">&times;</span></button><h2 class="modal-title"style="text-align: center;"id=""><strong>预约结果</strong></h2></div><div style="text-align: center;vertical-align: middle;padding:30% 0;"class="center-block"><img src="{$home}images/success.png"alt=""widht="16"><p>预约成功！稍后会有客服人员与您联系，请注意接听</p></div>';
             $('#myModals-appointment').find('.modal-content').html('').append(successHtml);
             $('.yuyue-success').text('已预约').css({ 'background-color':'#5CB85C',"color":"#fff"}).unbind('click');
           }
           else{
             console.log(response);
           }

        }

      })
       }

})

//提交意向车型
$('.yx-sub').unbind('click').bind('click',function(){
  {literal}
  var re1 = /^[\u4E00-\u9FA5]{2,8}$/; 
  {/literal}
  var useVal = $('.intention_username').val();
  if(!re1.test(useVal)){
    $('.use-error').addClass('has-error');
  }else{
    $('.use-error').removeClass('has-error');
  }
  if($('.ct-err').hasClass('has-error')){
        

        layer.msg('请选择品牌', function(){
       });
  }
  else if($('.intention_car_type').val()=='--请选择品牌--'||$('.intention_car_data').val()=='--请选择车系--'){
      $('.ct-err').addClass('has-error');
      
       layer.msg('请选择品牌', function(){
       });
  }

  else if($('.is-erro').hasClass('has-error')){
       layer.msg('请选择城市', function(){
      });
  }
 else if($('.use-error').hasClass('has-error')){
     layer.msg('用户名格式错误', function(){
    });
}

  else{
    
    var intention_car_type = $('.intention_car_type').val(),
        intention_car_data = $('.intention_car_data').val()
        intention_province = $('#intention_province').val()
        intention_ctiy = $('#intention_ctiy').val()
        intention_username = $('.intention_username').val()
        intention_user_phone = $('#intention_user_phone').val()

      $.ajax({
        type:"post",
        url:"{url('home/type/ajaxIntention')}",
        data:{ 
            intention_car_type:intention_car_type,
            intention_car_data:intention_car_data,
            intention_province:intention_province,
            intention_ctiy:intention_ctiy,
            intention_username:intention_username,
            intention_user_phone:intention_user_phone
        },
        success:function(msg){
            if(msg==1){
              var successHtml = '<div class="modal-header"><button type="button"class="close"data-dismiss="modal"aria-label="Close"><span aria-hidden="true">&times;</span></button><h2 class="modal-title"style="text-align: center;"id=""><strong>意向结果</strong></h2></div><div style="text-align: center;vertical-align: middle;padding:30% 0;"class="center-block"><img src="{$home}images/success.png"alt=""widht="16"><p>填写意向车型成功！稍后会有客服人员与您联系，请注意接听</p></div>';
              $('#myModal-intention').find('.modal-content').html('').append(successHtml);
            }
            else{
              alert(0);
            }
        }
      })
  }
})

})

function goTop(){

  $('html,body').animate({ 'scrollTop':0},300);

}
$('.logout').unbind('click').click(function(){
  // alert(1);
var id =  '<li id="login-show"><a href="javascript:void(0);" class="login-car">登录</a></li>';

var session = '{$session}';
  
  
  ajax({
    url:"{url('home/login/logout')}",

    type:"GET",
   // data:{ session:session},
    success:function(response, xml){
      if(response==1){
        // alert(1);
        $('.logouts').remove();
      $('.navbar-nav').append(id);
        $('.yuyue,.guanzhu_nav,.user_logout,.logout').hide(200);
        $('.login-car').unbind('click').click(function(){
            $('#appointment-modal').removeClass('is-btns')
            $('.appointment-modal').removeClass('is-btns')
            $('.yxcx').removeClass('is-btn')
            $('.modal-body').find('input').val('');
          $("#myModal").modal('show');

      })

      }
      
       
    }
  })

})

//折叠退出
$('.logouts').on('click',function(){
 alert(1);
var id =  '<li id="login-show"><a href="javascript:void(0);" class="login-car">登录</a></li>';

var session = '{$session}';
  
  
  ajax({
    url:"{url('home/login/logout')}",

    type:"GET",
   // data:{ session:session},
    success:function(response, xml){
      if(response==1){
       $('.navbar-nav').append(id);
        $('.yuyue,.guanzhu_nav,.user_logout,.logouts').hide(200);
        // $('.user_logout').remove();
       

      }
      
       
    }
  })

})


$('.navbar-nav').on('click','.logouts',function(){
        var id =  '<li id="login-show"><a href="javascript:void(0);" class="login-car">登录</a></li>';

var session = '{$session}';
  
  
  ajax({
    url:"{url('home/login/logout')}",

    type:"GET",
   // data:{ session:session},
    success:function(response, xml){
      if(response==1){
       $('.navbar-nav').append(id);
        $('.yuyue,.guanzhu_nav,.user_logout,.logouts').hide(200);
        // $('.user_logout').remove();
       

      }
      
       
    }
  })
  })
//验证
$(document).ready(function(){

      $('.login-car').unbind('click').click(function(){
     
        if($('.yxcx').hasClass('is-btn')){
            $('.yxcx').removeClass('is-btn'); 
        }
         
       else if($('#appointment-modal').hasClass('is-btns')||$('.appointment-modal').hasClass('is-btns')){
          $('#appointment-modal').removeClass('is-btns');
          $('.appointment-modal').removeClass('is-btns');
      } 
      $("#myModal").modal('show');

      
  })
      $('.navbar-nav').on('click','#login-show',function(){
        if($('.yxcx').hasClass('is-btn')){
            $('.yxcx').removeClass('is-btn');
        }
         
       else if($('#appointment-modal').hasClass('is-btns')||$('.appointment-modal').hasClass('is-btns')){
          $('#appointment-modal').removeClass('is-btns');
          $('.appointment-modal').removeClass('is-btns');
      } 
      $("#myModal").modal('show');

      
  })

      {literal}
      $('#myModal').find('.mobile-val').blur(function(){
          var mobileVal = $(this).val();
          // alert(mobileVal);
          if(!(/^1[3|4|5|7|8][0-9]\d{8}$/.test(mobileVal))){
              $('.err-phone').addClass('glyphicon glyphicon-info-sign');
              $('.err-info').text('手机号格式错误');
              // $('.submit-moblie').attr('onclick','return false')
              {/literal}
          }else{
              $('.err-phone').removeClass('glyphicon glyphicon-info-sign');
              $('.err-info').text('');
              // $('.submit-moblie').attr('onclick','return true')
              var a = true;
              $('.yz-code').unbind('click').click(function() {
                  if(a){
                  
                              
                      $('.yz-code').css('cursor','not-allowed');
                   
                  var phone = $('#inputGroupSuccess3').val();

                  // console.log(phone);
                  ajax({
                         url: "{url('home/login/send')}",              //请求地址
                         type: "POST",                       //请求方式
                         data: { phone:phone },        //请求参数
                         dataType: "json",
                         success: function (response, xml) {
                             if(response==1){
                                 layer.msg('验证码以发送请注意查收~',{ time:2000},function(){
                                 
                                });

                                  var num = 60;

                                  var time =  setInterval(function () {
                                  
                                  $('.yz-code').text(num+'s后重新获取验证码'); 
                                  $('.yz-code').css('background','#e2e2e2');
                              
                                  $('.yz-code').css('cursor','not-allowed');
                                  a = false;
                                  num--;
                                  if(num==0){
                                      $('.yz-code').text('获取验证码');
                                      $('.yz-code').css('background','#fff');
                              
                                  $('.yz-code').css('cursor','pointer');
                                      a = true;
                                      // $('.yz-code').attrClass('.yz-code');
                                      clearInterval(time); 
                                  }
                               },1000)
                             }
                             else{
                              $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                              $('.err-info').text('验证码发送失败');
                              $('.submit-moblie').attr('onclick','return false')
                          }

                         },
                         fail: function (status) {
                             // 此处放失败后执行的代码
                         }
                     });
                  }
                  else{
                      return false;
                  }
              });


      
          }
          $('#btn-sub').unbind('click').click(function() {
            // alert(9);
                      // $("#btn-sub").attr("disabled", true); 
        var phone1 = $('#myModal').find('.mobile-val').val();
         // var phone1 = $('#myModal').find('.mobile-val').val();
        if(mobileVal == phone1){
            var code = $('.code-val').val();
            if(code == ''){
                $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                $('.err-info').text('请输入验证码');  
                return false;
            }
            ajax({
                    url:"{url('home/login/login')}",
                   type:"POST",
                   data:{ code:code,phone:mobileVal},
                   dataType: "json",
                   success: function(response, xml){
                    // alert(msg);
                        if(response == 0){
                            $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                            $('.err-info').text('验证码已过期,请重新获取');    
                        }else if(response == 1){
                          // alert(1);
                            ajax({
                                  url:"{url('home/type/isSession')}",

                                  type:"GET",
                                  dataType: "json",
                                  success:function(response, xml){
                                        $("#myModal").modal('hide');
                                        if($('.intention-car').hasClass('is-btn')){
                                          $("#myModal-intention").modal('show');
                        
                                         $("#myModal-intention").find('.mobile-session').val(response);
                                                     $('.logouts').remove();
                                                       $('.navbar-nav').find('#login-show').detach(); 
                                                      mShow();
                                                     loginOut();
                                                       // $("#btn-sub").attr("disabled", false); 
                                          }else if($('#appointment-modal').hasClass('is-btns')||$('.appointment-modal').hasClass('is-btns')){
                                                 $("#myModals-appointment").modal('show').find('.mobile-session').val(response);
                                                    $('.logouts').remove();
                                                      $('.navbar-nav').find('#login-show').detach(); 
                                                  mShow();
                                                   loginOut();
                                                    // $("#btn-sub").attr("disabled", false); 
                                                    
                                              }else{
                                                // alert(1);
                                                   $('.logouts').remove();
                                                     $('.navbar-nav').find('#login-show').detach(); 
                                                   mShow();
                                                   loginOut();
                                                    // $("#btn-sub").attr("disabled", false); 
                                              }
                                                    }
                            
                           
                           
                    })
                            
                        }else if(response == 2){
                            // alert(2)
                            $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                            $('.err-info').text('验证码错误');   
                        }else if(response == 3){
                          // alert(3);
                             $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                            $('.err-info').text('验证码错误,请重新输入'); 
                        }
                   }
                          })
                      }else{
                          $('.err-phone').addClass('glyphicon glyphicon-info-sign');
                          $('.err-info').text('验证码错误');
                      }
          });
      })
　　
    //预约
      var isSession = '{$session}';
      var isCheck = $('#appointment-modal,.appointment-modal').unbind('click').click(function(){

        $(this).addClass('is-btns');
        ajax({
          url:"{url('home/type/isSession')}",
          type:"GET",
          success:function(response, xml){
            if(response==1){
              layer.msg('请先登录',{ time:1000},function(){
              $("#myModal").modal('show');//显示登录框
              
          });
              
            }
             else{
            $("#myModals-appointment").modal('show');
              $("#myModals-appointment").find('.mobile-session').val(response);
        }
          },
        })
          
       
       
         
        
      }) 
      function mShow(){
        
          // alert(shows);
         
        
            var id = '<li class="yuyue nav5"><a href="{url("home/"|cat:$navigation[4].navigation_url)}">{$navigation[4].navigation_name}<span class="layui-badge">{$yuYueNum|@count}</span></a></li><li class="guanzhu_nav nav6"><a href="{url("home/"|cat:$navigation[5].navigation_url)}">{$navigation[5].navigation_name}<img src="{$home}images/attention-yet-icon.png"height="16"></a></li><div style="padding-left: 25px;"class="hidden-md hidden-lg hidden-md logouts"><a href="#" onclick="return false" class="btn btn-danger btn-block  "><div class=""style="display: block;">退出登录</div></a></div><li class="user_logout hidden-xs"><a href=""><i class="iconfont icon-avatar"></i></a></li>';
                $('.navbar-nav').append(id);
       
         
      }


     


      //意向车型
           var isCheck = $('.yxcx').unbind('click').click(function(){
        $(this).addClass('is-btn');
          $.ajax({
            type:"get",
            url:"{url('home/type/isSession')}",
            success:function(data){
                if(data==1){ //没有session
                    layer.msg('请先登录',{ time:1000},function(){
                       $("#myModal").modal('show');//显示登录框
                      
                    });
                  
                  // 

                 // $('.modal-content').html('').append('<div style="height:100px">123</div>');
                }else{
                  $("#myModal-intention").modal('show');
                  $("#myModal-intention").find('.mobile-session').val(data);
                }
                
            }
          })
        
      }) 
      
  
});
//预约日期
 var day2 = new Date();

 
  day2.setTime(day2.getTime());
  var s2 = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate();
 $(".form_datetime").datetimepicker({
      minView: "month",
     format: "yyyy-mm-dd",
     autoclose: true,
     todayBtn: true,
     language:'zh-CN',
     startDate: s2,
     minuteStep: 10
 });
var s3 = day2.getFullYear()+"-" + (day2.getMonth()+1) + "-" + day2.getDate();
 $('input[name="subscribe_time"]').attr('value',s3); 
loginOut();
function loginOut(){

var timer=null;

$(".user_logout").mouseover(function(){
            clearTimeout(timer);
            $('.logout').show();
        }).mouseout(function(){
            timer=setTimeout(function(){
                $('.logout').hide();
            },100)
        });
        $(".logout").mouseover(function(){
            clearTimeout(timer);
            $('.logout').show();
        }).mouseout(function(){
            timer=setTimeout(function(){
                $('.logout').hide();
            },100)
        })
}



//品牌循环
$('.car-info-sel-1').find('select').on('change',function(){
  var selVal = $(this).val();
  // alert(selVal);
  if(selVal=='--请选择品牌--'){
    $('.car-info-sel-2').find('select').attr('disabled','disabled').find('option').text('--请选择车型--');
    $('.ct-err').addClass('has-error');

  }else{
    $('.ct-err').removeClass('has-error');
     $('.car-info-sel-2').find('select').find('option').remove()
    {foreach $carinfo as $v}
    {foreach $v as $va}
     {foreach $va as $k=>$val}
     
     
     // alert(selVal);
    if(selVal == '{$k}'){
       {foreach $val as $key=>$value}
      $('.car-info-sel-2').find('select').append(' <option>{$value}</option>') ;
       {/foreach}
    }
     {/foreach}
    {/foreach}
    {/foreach}
    $('.car-info-sel-2').find('select').removeAttr('disabled');

  }
    
});




//获取goods_id

  var  url= window.location.href
   
  var  ss = url.split('/');
  for(var i =0 ;i<ss.length;i++){
      if(ss[i]=='details')
      $('input[name="goods_id"]:hidden').val(ss[i+1]);//添加到预约hidden中提交
  }





function ajax(options) {
      options = options || {};
      options.type = (options.type || "GET").toUpperCase();
      options.dataType = options.dataType || "json";
      var params = formatParams(options.data);
      // console.log(typeof(params));
      //创建 - 非IE6 - 第一步
      if (window.XMLHttpRequest) {
          var xhr = new XMLHttpRequest();
      } else { //IE6及其以下版本浏览器
          var xhr = new ActiveXObject('Microsoft.XMLHTTP');
      }
      //接收 - 第三步
      xhr.onreadystatechange = function () {
          if (xhr.readyState == 4) {
              var status = xhr.status;
              if (status >= 200 && status < 300) {
                  options.success && options.success(xhr.responseText, xhr.responseXML);
              } else {
                  options.fail && options.fail(status);
              }
          }
      }
      //连接 和 发送 - 第二步
      if (options.type == "GET") {
          xhr.open("GET", options.url + "?" + params, true);
          xhr.send(null);
      } else if (options.type == "POST") {
          xhr.open("POST", options.url, true);
          //设置表单提交时的内容类型
          xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
          xhr.send(params);
      }
  }
  //格式化参数
  function formatParams(data) {
      var arr = [];
      for (var name in data) {
          arr.push(encodeURIComponent(name) + "=" + encodeURIComponent(data[name]));
      }
      arr.push(("v=" + Math.random()).replace(".",""));
      return arr.join("&");
  }


</script>



</body>
</html>